#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#define PI 3.14
int main()
{
	int centerX = 100, centerY = 100, r = 100;
	int left, top, right, bottom, i;
	float offset;
	float set = 0;
	initgraph(1200, 800);
	setbkcolor(RGB(128, 128, 128));
	cleardevice();
	while (1)
	{
		for (centerX = 100; centerX <= 1100; centerX = centerX + 200)
		{
			for (centerY = 100; centerY <= 700; centerY = centerY + 200)
			{
				float h = rand() % 180;
				COLORREF color1 = HSVtoRGB(h, 0.9, 0.8);
				COLORREF color2 = HSVtoRGB(h + 180, 0.9, 0.8);
				for (r = 100; r > 0; r = r - 20)
				{
					left = centerX - r;
					top = centerY - r;
					right = centerX + r;
					bottom = centerY + r;
					for (i = 0; i <= 19; i++)
					{
						offset = PI / 10.0 * i + set;
						setfillcolor(color1);
						solidpie(left, top, right, bottom, offset, 2 * PI / 60 + offset);
						setfillcolor(RGB(255, 255, 255));
						solidpie(left, top, right, bottom, 2 * PI / 60 + offset, 3 * PI / 60 + offset);
						setfillcolor(color2);
						solidpie(left, top, right, bottom, 3 * PI / 60 + offset, 5 * PI / 60 + offset);
						setfillcolor(RGB(0, 0, 0));
						solidpie(left, top, right, bottom, 5 * PI / 60 + offset, 6 * PI / 60 + offset);
					}
					set = set + PI / 20.0;
				}
			}
		}
		int d = _getch();
	}
	return 0;
}